<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<script type="text/javascript">

    function SuperType(name) {
        this.name = name
        this.colors = ['red', 'orange', 'yellow']
    }
    SuperType.prototype.sayName = function () {
        console.log(this.name)
    }
    function SubType(name, age) {
        SuperType.call(this, name)      // 第二次调用SuperType
        this.age = age
    }
    SubType.prototype = new SuperType() // 第一次调用SuperType
    SubType.prototype.constructor = SubType
    SubType.prototype.sayAge = function () {
        console.log(this.age)
    }

</script>

</body>
</html>
